package com.yunchao.feature.base.presentation.ext

import android.content.Context
import android.content.Intent
import android.widget.Toast
import androidx.annotation.StringRes
import androidx.appcompat.app.AppCompatActivity
import androidx.core.os.bundleOf
import androidx.fragment.app.Fragment
import kotlin.reflect.KProperty1

fun Context.toast(@StringRes resId: Int, length: Int = Toast.LENGTH_LONG) {
    Toast.makeText(this, getString(resId), length).show()
}

fun Fragment.toast(@StringRes resId: Int, length: Int = Toast.LENGTH_LONG) {
    Toast.makeText(this.requireActivity(), getString(resId), length).show()
}

fun Context.toast(message: String?, length: Int = Toast.LENGTH_LONG) {
    Toast.makeText(this, message, length).show()
}

fun Fragment.toast(message: String?, length: Int = Toast.LENGTH_LONG) {
    Toast.makeText(this.requireActivity(), message, length).show()
}
